\documentclass[11pt]{article}

    \usepackage[breakable]{tcolorbox}
    \usepackage{parskip} % Stop auto-indenting (to mimic markdown behaviour)
    
    \usepackage{iftex}
    \ifPDFTeX
    	\usepackage[T1]{fontenc}
    	\usepackage{mathpazo}
    \else
    	\usepackage{fontspec}
    \fi

    % Basic figure setup, for now with no caption control since it's done
    % automatically by Pandoc (which extracts ![](path) syntax from Markdown).
    \usepackage{graphicx}
    % Maintain compatibility with old templates. Remove in nbconvert 6.0
    \let\Oldincludegraphics\includegraphics
    % Ensure that by default, figures have no caption (until we provide a
    % proper Figure object with a Caption API and a way to capture that
    % in the conversion process - todo).
    \usepackage{caption}
    \DeclareCaptionFormat{nocaption}{}
    \captionsetup{format=nocaption,aboveskip=0pt,belowskip=0pt}

    \usepackage{float}
    \floatplacement{figure}{H} % forces figures to be placed at the correct location
    \usepackage{xcolor} % Allow colors to be defined
    \usepackage{enumerate} % Needed for markdown enumerations to work
    \usepackage{geometry} % Used to adjust the document margins
    \usepackage{amsmath} % Equations
    \usepackage{amssymb} % Equations
    \usepackage{textcomp} % defines textquotesingle
    % Hack from http://tex.stackexchange.com/a/47451/13684:
    \AtBeginDocument{%
        \def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code
    }
    \usepackage{upquote} % Upright quotes for verbatim code
    \usepackage{eurosym} % defines \euro
    \usepackage[mathletters]{ucs} % Extended unicode (utf-8) support
    \usepackage{fancyvrb} % verbatim replacement that allows latex
    \usepackage{grffile} % extends the file name processing of package graphics 
                         % to support a larger range
    \makeatletter % fix for old versions of grffile with XeLaTeX
    \@ifpackagelater{grffile}{2019/11/01}
    {
      % Do nothing on new versions
    }
    {
      \def\Gread@@xetex#1{%
        \IfFileExists{"\Gin@base".bb}%
        {\Gread@eps{\Gin@base.bb}}%
        {\Gread@@xetex@aux#1}%
      }
    }
    \makeatother
    \usepackage[Export]{adjustbox} % Used to constrain images to a maximum size
    \adjustboxset{max size={0.9\linewidth}{0.9\paperheight}}

    % The hyperref package gives us a pdf with properly built
    % internal navigation ('pdf bookmarks' for the table of contents,
    % internal cross-reference links, web links for URLs, etc.)
    \usepackage{hyperref}
    % The default LaTeX title has an obnoxious amount of whitespace. By default,
    % titling removes some of it. It also provides customization options.
    \usepackage{titling}
    \usepackage{longtable} % longtable support required by pandoc >1.10
    \usepackage{booktabs}  % table support for pandoc > 1.12.2
    \usepackage[inline]{enumitem} % IRkernel/repr support (it uses the enumerate* environment)
    \usepackage[normalem]{ulem} % ulem is needed to support strikethroughs (\sout)
                                % normalem makes italics be italics, not underlines
    \usepackage{mathrsfs}
    

    
    % Colors for the hyperref package
    \definecolor{urlcolor}{rgb}{0,.145,.698}
    \definecolor{linkcolor}{rgb}{.71,0.21,0.01}
    \definecolor{citecolor}{rgb}{.12,.54,.11}

    % ANSI colors
    \definecolor{ansi-black}{HTML}{3E424D}
    \definecolor{ansi-black-intense}{HTML}{282C36}
    \definecolor{ansi-red}{HTML}{E75C58}
    \definecolor{ansi-red-intense}{HTML}{B22B31}
    \definecolor{ansi-green}{HTML}{00A250}
    \definecolor{ansi-green-intense}{HTML}{007427}
    \definecolor{ansi-yellow}{HTML}{DDB62B}
    \definecolor{ansi-yellow-intense}{HTML}{B27D12}
    \definecolor{ansi-blue}{HTML}{208FFB}
    \definecolor{ansi-blue-intense}{HTML}{0065CA}
    \definecolor{ansi-magenta}{HTML}{D160C4}
    \definecolor{ansi-magenta-intense}{HTML}{A03196}
    \definecolor{ansi-cyan}{HTML}{60C6C8}
    \definecolor{ansi-cyan-intense}{HTML}{258F8F}
    \definecolor{ansi-white}{HTML}{C5C1B4}
    \definecolor{ansi-white-intense}{HTML}{A1A6B2}
    \definecolor{ansi-default-inverse-fg}{HTML}{FFFFFF}
    \definecolor{ansi-default-inverse-bg}{HTML}{000000}

    % common color for the border for error outputs.
    \definecolor{outerrorbackground}{HTML}{FFDFDF}

    % commands and environments needed by pandoc snippets
    % extracted from the output of `pandoc -s`
    \providecommand{\tightlist}{%
      \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
    \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
    % Add ',fontsize=\small' for more characters per line
    \newenvironment{Shaded}{}{}
    \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
    \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}
    \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
    \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
    \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
    \newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
    \newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
    \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}}
    \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
    \newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
    \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}
    \newcommand{\RegionMarkerTok}[1]{{#1}}
    \newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
    \newcommand{\NormalTok}[1]{{#1}}
    
    % Additional commands for more recent versions of Pandoc
    \newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{{#1}}}
    \newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
    \newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
    \newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{{#1}}}
    \newcommand{\ImportTok}[1]{{#1}}
    \newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{{#1}}}}
    \newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
    \newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
    \newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{{#1}}}
    \newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
    \newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{{#1}}}
    \newcommand{\BuiltInTok}[1]{{#1}}
    \newcommand{\ExtensionTok}[1]{{#1}}
    \newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{{#1}}}
    \newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{{#1}}}
    \newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
    \newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
    
    
    % Define a nice break command that doesn't care if a line doesn't already
    % exist.
    \def\br{\hspace*{\fill} \\* }
    % Math Jax compatibility definitions
    \def\gt{>}
    \def\lt{<}
    \let\Oldtex\TeX
    \let\Oldlatex\LaTeX
    \renewcommand{\TeX}{\textrm{\Oldtex}}
    \renewcommand{\LaTeX}{\textrm{\Oldlatex}}
    % Document parameters
    % Document title
    \title{ex\_1\_3}
    
    
    
    
    
% Pygments definitions
\makeatletter
\def\PY@reset{\let\PY@it=\relax \let\PY@bf=\relax%
    \let\PY@ul=\relax \let\PY@tc=\relax%
    \let\PY@bc=\relax \let\PY@ff=\relax}
\def\PY@tok#1{\csname PY@tok@#1\endcsname}
\def\PY@toks#1+{\ifx\relax#1\empty\else%
    \PY@tok{#1}\expandafter\PY@toks\fi}
\def\PY@do#1{\PY@bc{\PY@tc{\PY@ul{%
    \PY@it{\PY@bf{\PY@ff{#1}}}}}}}
\def\PY#1#2{\PY@reset\PY@toks#1+\relax+\PY@do{#2}}

\@namedef{PY@tok@w}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}
\@namedef{PY@tok@c}{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\@namedef{PY@tok@cp}{\def\PY@tc##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}}
\@namedef{PY@tok@k}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@kp}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@kt}{\def\PY@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}}
\@namedef{PY@tok@o}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@ow}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
\@namedef{PY@tok@nb}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@nf}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PY@tok@nc}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PY@tok@nn}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PY@tok@ne}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}}
\@namedef{PY@tok@nv}{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PY@tok@no}{\def\PY@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}}
\@namedef{PY@tok@nl}{\def\PY@tc##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}}
\@namedef{PY@tok@ni}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}}
\@namedef{PY@tok@na}{\def\PY@tc##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}}
\@namedef{PY@tok@nt}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@nd}{\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
\@namedef{PY@tok@s}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@sd}{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@si}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
\@namedef{PY@tok@se}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}}
\@namedef{PY@tok@sr}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
\@namedef{PY@tok@ss}{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PY@tok@sx}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@m}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@gh}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
\@namedef{PY@tok@gu}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}}
\@namedef{PY@tok@gd}{\def\PY@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}}
\@namedef{PY@tok@gi}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}}
\@namedef{PY@tok@gr}{\def\PY@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}}
\@namedef{PY@tok@ge}{\let\PY@it=\textit}
\@namedef{PY@tok@gs}{\let\PY@bf=\textbf}
\@namedef{PY@tok@gp}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
\@namedef{PY@tok@go}{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
\@namedef{PY@tok@gt}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}}
\@namedef{PY@tok@err}{\def\PY@bc##1{{\setlength{\fboxsep}{-\fboxrule}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}}}
\@namedef{PY@tok@kc}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@kd}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@kn}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@kr}{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@bp}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
\@namedef{PY@tok@fm}{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
\@namedef{PY@tok@vc}{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PY@tok@vg}{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PY@tok@vi}{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PY@tok@vm}{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
\@namedef{PY@tok@sa}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@sb}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@sc}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@dl}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@s2}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@sh}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@s1}{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
\@namedef{PY@tok@mb}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@mf}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@mh}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@mi}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@il}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@mo}{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\@namedef{PY@tok@ch}{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\@namedef{PY@tok@cm}{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\@namedef{PY@tok@cpf}{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\@namedef{PY@tok@c1}{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
\@namedef{PY@tok@cs}{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}

\def\PYZbs{\char`\\}
\def\PYZus{\char`\_}
\def\PYZob{\char`\{}
\def\PYZcb{\char`\}}
\def\PYZca{\char`\^}
\def\PYZam{\char`\&}
\def\PYZlt{\char`\<}
\def\PYZgt{\char`\>}
\def\PYZsh{\char`\#}
\def\PYZpc{\char`\%}
\def\PYZdl{\char`\$}
\def\PYZhy{\char`\-}
\def\PYZsq{\char`\'}
\def\PYZdq{\char`\"}
\def\PYZti{\char`\~}
% for compatibility with earlier versions
\def\PYZat{@}
\def\PYZlb{[}
\def\PYZrb{]}
\makeatother


    % For linebreaks inside Verbatim environment from package fancyvrb. 
    \makeatletter
        \newbox\Wrappedcontinuationbox 
        \newbox\Wrappedvisiblespacebox 
        \newcommand*\Wrappedvisiblespace {\textcolor{red}{\textvisiblespace}} 
        \newcommand*\Wrappedcontinuationsymbol {\textcolor{red}{\llap{\tiny$\m@th\hookrightarrow$}}} 
        \newcommand*\Wrappedcontinuationindent {3ex } 
        \newcommand*\Wrappedafterbreak {\kern\Wrappedcontinuationindent\copy\Wrappedcontinuationbox} 
        % Take advantage of the already applied Pygments mark-up to insert 
        % potential linebreaks for TeX processing. 
        %        {, <, #, %, $, ' and ": go to next line. 
        %        _, }, ^, &, >, - and ~: stay at end of broken line. 
        % Use of \textquotesingle for straight quote. 
        \newcommand*\Wrappedbreaksatspecials {% 
            \def\PYGZus{\discretionary{\char`\_}{\Wrappedafterbreak}{\char`\_}}% 
            \def\PYGZob{\discretionary{}{\Wrappedafterbreak\char`\{}{\char`\{}}% 
            \def\PYGZcb{\discretionary{\char`\}}{\Wrappedafterbreak}{\char`\}}}% 
            \def\PYGZca{\discretionary{\char`\^}{\Wrappedafterbreak}{\char`\^}}% 
            \def\PYGZam{\discretionary{\char`\&}{\Wrappedafterbreak}{\char`\&}}% 
            \def\PYGZlt{\discretionary{}{\Wrappedafterbreak\char`\<}{\char`\<}}% 
            \def\PYGZgt{\discretionary{\char`\>}{\Wrappedafterbreak}{\char`\>}}% 
            \def\PYGZsh{\discretionary{}{\Wrappedafterbreak\char`\#}{\char`\#}}% 
            \def\PYGZpc{\discretionary{}{\Wrappedafterbreak\char`\%}{\char`\%}}% 
            \def\PYGZdl{\discretionary{}{\Wrappedafterbreak\char`\$}{\char`\$}}% 
            \def\PYGZhy{\discretionary{\char`\-}{\Wrappedafterbreak}{\char`\-}}% 
            \def\PYGZsq{\discretionary{}{\Wrappedafterbreak\textquotesingle}{\textquotesingle}}% 
            \def\PYGZdq{\discretionary{}{\Wrappedafterbreak\char`\"}{\char`\"}}% 
            \def\PYGZti{\discretionary{\char`\~}{\Wrappedafterbreak}{\char`\~}}% 
        } 
        % Some characters . , ; ? ! / are not pygmentized. 
        % This macro makes them "active" and they will insert potential linebreaks 
        \newcommand*\Wrappedbreaksatpunct {% 
            \lccode`\~`\.\lowercase{\def~}{\discretionary{\hbox{\char`\.}}{\Wrappedafterbreak}{\hbox{\char`\.}}}% 
            \lccode`\~`\,\lowercase{\def~}{\discretionary{\hbox{\char`\,}}{\Wrappedafterbreak}{\hbox{\char`\,}}}% 
            \lccode`\~`\;\lowercase{\def~}{\discretionary{\hbox{\char`\;}}{\Wrappedafterbreak}{\hbox{\char`\;}}}% 
            \lccode`\~`\:\lowercase{\def~}{\discretionary{\hbox{\char`\:}}{\Wrappedafterbreak}{\hbox{\char`\:}}}% 
            \lccode`\~`\?\lowercase{\def~}{\discretionary{\hbox{\char`\?}}{\Wrappedafterbreak}{\hbox{\char`\?}}}% 
            \lccode`\~`\!\lowercase{\def~}{\discretionary{\hbox{\char`\!}}{\Wrappedafterbreak}{\hbox{\char`\!}}}% 
            \lccode`\~`\/\lowercase{\def~}{\discretionary{\hbox{\char`\/}}{\Wrappedafterbreak}{\hbox{\char`\/}}}% 
            \catcode`\.\active
            \catcode`\,\active 
            \catcode`\;\active
            \catcode`\:\active
            \catcode`\?\active
            \catcode`\!\active
            \catcode`\/\active 
            \lccode`\~`\~ 	
        }
    \makeatother

    \let\OriginalVerbatim=\Verbatim
    \makeatletter
    \renewcommand{\Verbatim}[1][1]{%
        %\parskip\z@skip
        \sbox\Wrappedcontinuationbox {\Wrappedcontinuationsymbol}%
        \sbox\Wrappedvisiblespacebox {\FV@SetupFont\Wrappedvisiblespace}%
        \def\FancyVerbFormatLine ##1{\hsize\linewidth
            \vtop{\raggedright\hyphenpenalty\z@\exhyphenpenalty\z@
                \doublehyphendemerits\z@\finalhyphendemerits\z@
                \strut ##1\strut}%
        }%
        % If the linebreak is at a space, the latter will be displayed as visible
        % space at end of first line, and a continuation symbol starts next line.
        % Stretch/shrink are however usually zero for typewriter font.
        \def\FV@Space {%
            \nobreak\hskip\z@ plus\fontdimen3\font minus\fontdimen4\font
            \discretionary{\copy\Wrappedvisiblespacebox}{\Wrappedafterbreak}
            {\kern\fontdimen2\font}%
        }%
        
        % Allow breaks at special characters using \PYG... macros.
        \Wrappedbreaksatspecials
        % Breaks at punctuation characters . , ; ? ! and / need catcode=\active 	
        \OriginalVerbatim[#1,codes*=\Wrappedbreaksatpunct]%
    }
    \makeatother

    % Exact colors from NB
    \definecolor{incolor}{HTML}{303F9F}
    \definecolor{outcolor}{HTML}{D84315}
    \definecolor{cellborder}{HTML}{CFCFCF}
    \definecolor{cellbackground}{HTML}{F7F7F7}
    
    % prompt
    \makeatletter
    \newcommand{\boxspacing}{\kern\kvtcb@left@rule\kern\kvtcb@boxsep}
    \makeatother
    \newcommand{\prompt}[4]{
        {\ttfamily\llap{{\color{#2}[#3]:\hspace{3pt}#4}}\vspace{-\baselineskip}}
    }
    

    
    % Prevent overflowing lines due to hard-to-break entities
    \sloppy 
    % Setup hyperref package
    \hypersetup{
      breaklinks=true,  % so long urls are correctly broken across lines
      colorlinks=true,
      urlcolor=urlcolor,
      linkcolor=linkcolor,
      citecolor=citecolor,
      }
    % Slightly bigger margins than the latex defaults
    
    \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
    
    

\begin{document}
    
    \maketitle
    
    

    
    \hypertarget{ux4e60ux9898-1.3}{%
\subsection{习题 1.3}\label{ux4e60ux9898-1.3}}

数据：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{1}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{data} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{read.table}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{./ex\PYZus{}1\PYZus{}3.txt\PYZdq{}}\PY{p}{,} \PY{n}{header}\PY{o}{=}\PY{k+kc}{TRUE}\PY{p}{)}
\PY{n}{data}
\end{Verbatim}
\end{tcolorbox}

    A data.frame: 22 × 4
\begin{tabular}{llll}
 Year & Nationwide & Rural & Urban\\
 <int> & <int> & <int> & <int>\\
\hline
	 1978 &  184 &  138 &  405\\
	 1979 &  207 &  158 &  434\\
	 1980 &  236 &  178 &  496\\
	 1981 &  262 &  199 &  562\\
	 1982 &  284 &  221 &  576\\
	 1983 &  311 &  246 &  603\\
	 1984 &  354 &  283 &  662\\
	 1985 &  437 &  347 &  802\\
	 1986 &  485 &  376 &  920\\
	 1987 &  550 &  417 & 1089\\
	 1988 &  693 &  508 & 1431\\
	 1989 &  762 &  553 & 1568\\
	 1990 &  803 &  571 & 1686\\
	 1991 &  896 &  621 & 1925\\
	 1992 & 1070 &  718 & 2356\\
	 1993 & 1331 &  855 & 3027\\
	 1994 & 1746 & 1118 & 3891\\
	 1995 & 2336 & 1434 & 4874\\
	 1996 & 2641 & 1768 & 5430\\
	 1997 & 2834 & 1876 & 5796\\
	 1998 & 2972 & 1895 & 6217\\
	 1999 & 3180 & 1973 & 6651\\
\end{tabular}


    
    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{2}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{summary}\PY{p}{(}\PY{n}{data}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    
    \begin{Verbatim}[commandchars=\\\{\}]
      Year        Nationwide         Rural            Urban       
 Min.   :1978   Min.   : 184.0   Min.   : 138.0   Min.   : 405.0  
 1st Qu.:1983   1st Qu.: 321.8   1st Qu.: 255.2   1st Qu.: 617.8  
 Median :1988   Median : 727.5   Median : 530.5   Median :1499.5  
 Mean   :1988   Mean   :1117.0   Mean   : 747.9   Mean   :2336.4  
 3rd Qu.:1994   3rd Qu.:1642.2   3rd Qu.:1052.2   3rd Qu.:3675.0  
 Max.   :1999   Max.   :3180.0   Max.   :1973.0   Max.   :6651.0  
    \end{Verbatim}

    
    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{3}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{attach}\PY{p}{(}\PY{n}{data}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    方便直接使用 Year, Nationwide, Rural, Urban 这几个变量。

    \hypertarget{section}{%
\subsubsection{(1)}\label{section}}

求均值、方差、标准差、变异系数、偏度、峰度

\textbf{均值}：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{4}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{c}\PY{p}{(}\PY{n+nf}{mean}\PY{p}{(}\PY{n}{Nationwide}\PY{p}{)}\PY{p}{,} \PY{n+nf}{mean}\PY{p}{(}\PY{n}{Rural}\PY{p}{)}\PY{p}{,} \PY{n+nf}{mean}\PY{p}{(}\PY{n}{Urban}\PY{p}{)}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{enumerate*}
\item 1117
\item 747.863636363636
\item 2336.40909090909
\end{enumerate*}


    
    或者，R 提供有一个更方便的函数 \texttt{colMeans}，可以直接计算 data
frame 各列均值 (\texttt{data{[}-1{]}} 排除了第一列 Year)：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{5}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{colMeans}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{l+m}{\PYZhy{}1}\PY{p}{]}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{description*}
\item[Nationwide] 1117
\item[Rural] 747.863636363636
\item[Urban] 2336.40909090909
\end{description*}


    
    colMeans 函数等价于如下 apply:

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{6}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{apply}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{l+m}{\PYZhy{}1}\PY{p}{]}\PY{p}{,} \PY{n}{MARGIN}\PY{o}{=}\PY{l+m}{2}\PY{p}{,} \PY{n}{FUN}\PY{o}{=}\PY{n}{mean}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{description*}
\item[Nationwide] 1117
\item[Rural] 747.863636363636
\item[Urban] 2336.40909090909
\end{description*}


    
    注：\texttt{MARGIN\ =\ 2} 就是取列。

    \textbf{方差}：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{7}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{apply}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{l+m}{\PYZhy{}1}\PY{p}{]}\PY{p}{,} \PY{l+m}{2}\PY{p}{,} \PY{n}{var}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{description*}
\item[Nationwide] 1031680.28571429
\item[Rural] 399673.837662338
\item[Urban] 4536136.44372294
\end{description*}


    
    \textbf{标准差}：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{8}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{apply}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{l+m}{\PYZhy{}1}\PY{p}{]}\PY{p}{,} \PY{l+m}{2}\PY{p}{,} \PY{n}{sd}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{description*}
\item[Nationwide] 1015.71663652531
\item[Rural] 632.197625479832
\item[Urban] 2129.82075389525
\end{description*}


    
    \textbf{变异系数}：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{9}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{cv} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{function}\PY{p}{(}\PY{n}{x}\PY{p}{)} \PY{n+nf}{sd}\PY{p}{(}\PY{n}{x}\PY{p}{)}\PY{o}{/}\PY{n+nf}{mean}\PY{p}{(}\PY{n}{x}\PY{p}{)}

\PY{n+nf}{apply}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{l+m}{\PYZhy{}1}\PY{p}{]}\PY{p}{,} \PY{l+m}{2}\PY{p}{,} \PY{n}{cv}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{description*}
\item[Nationwide] 0.90932554747118
\item[Rural] 0.845338100076357
\item[Urban] 0.91157869663422
\end{description*}


    
    \textbf{偏度}（skewness）：

    可以调用一个库完成计算：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{10}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{c+c1}{\PYZsh{} install.packages(\PYZdq{}psych\PYZdq{})}
\PY{n+nf}{library}\PY{p}{(}\PY{n}{psych}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{11}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{c+c1}{\PYZsh{} g1 \PYZlt{}\PYZhy{} function(x) skew(x, type=2)  \PYZsh{} g1、g2 是用 type=2: seehelp(skew)}

\PY{c+c1}{\PYZsh{} or 按照书上（P6）的手写这个函数}
\PY{n}{g1} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{function}\PY{p}{(}\PY{n}{x}\PY{p}{)} \PY{p}{\PYZob{}}
    \PY{n}{n} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{length}\PY{p}{(}\PY{n}{x}\PY{p}{)}
    
    \PY{n}{A} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n}{n} \PY{o}{/} \PY{p}{(}\PY{p}{(}\PY{n}{n}\PY{l+m}{\PYZhy{}1}\PY{p}{)} \PY{o}{*} \PY{p}{(}\PY{n}{n}\PY{l+m}{\PYZhy{}2}\PY{p}{)}\PY{p}{)}
    \PY{n}{B} \PY{o}{\PYZlt{}\PYZhy{}} \PY{l+m}{1} \PY{o}{/} \PY{n+nf}{sd}\PY{p}{(}\PY{n}{x}\PY{p}{)}\PY{o}{\PYZca{}}\PY{l+m}{3}
    \PY{n}{S} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{sum}\PY{p}{(}\PY{p}{(}\PY{n}{x} \PY{o}{\PYZhy{}} \PY{n+nf}{mean}\PY{p}{(}\PY{n}{x}\PY{p}{)}\PY{p}{)}\PY{o}{\PYZca{}}\PY{l+m}{3}\PY{p}{)}
    
    \PY{n}{A} \PY{o}{*} \PY{n}{B} \PY{o}{*} \PY{n}{S}
\PY{p}{\PYZcb{}}

\PY{n+nf}{apply}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{l+m}{\PYZhy{}1}\PY{p}{]}\PY{p}{,} \PY{l+m}{2}\PY{p}{,} \PY{n}{g1}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{description*}
\item[Nationwide] 1.02484718945818
\item[Rural] 1.01256119786818
\item[Urban] 0.970464107448573
\end{description*}


    
    \textbf{峰度}：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{12}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{c+c1}{\PYZsh{} g2 \PYZlt{}\PYZhy{} function(x) kurtosi(x, type=2)  \PYZsh{} help(kurtosi)}

\PY{n}{g2} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{function}\PY{p}{(}\PY{n}{x}\PY{p}{)} \PY{p}{\PYZob{}}
    \PY{n}{n} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{length}\PY{p}{(}\PY{n}{x}\PY{p}{)}
    
    \PY{n}{A} \PY{o}{\PYZlt{}\PYZhy{}} \PY{p}{(}\PY{n}{n} \PY{o}{*} \PY{p}{(}\PY{n}{n}\PY{l+m}{+1}\PY{p}{)}\PY{p}{)} \PY{o}{/} \PY{p}{(}\PY{p}{(}\PY{n}{n}\PY{l+m}{\PYZhy{}1}\PY{p}{)} \PY{o}{*} \PY{p}{(}\PY{n}{n}\PY{l+m}{\PYZhy{}2}\PY{p}{)} \PY{o}{*} \PY{p}{(}\PY{n}{n}\PY{l+m}{\PYZhy{}3}\PY{p}{)}\PY{p}{)}
    \PY{n}{B} \PY{o}{\PYZlt{}\PYZhy{}} \PY{l+m}{1} \PY{o}{/} \PY{n+nf}{sd}\PY{p}{(}\PY{n}{x}\PY{p}{)}\PY{o}{\PYZca{}}\PY{l+m}{4}
    \PY{n}{S} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{sum}\PY{p}{(}\PY{p}{(}\PY{n}{x} \PY{o}{\PYZhy{}} \PY{n+nf}{mean}\PY{p}{(}\PY{n}{x}\PY{p}{)}\PY{p}{)}\PY{o}{\PYZca{}}\PY{l+m}{4}\PY{p}{)}
    \PY{n}{C} \PY{o}{\PYZlt{}\PYZhy{}} \PY{p}{(}\PY{l+m}{3} \PY{o}{*} \PY{p}{(}\PY{n}{n}\PY{l+m}{\PYZhy{}1}\PY{p}{)}\PY{o}{\PYZca{}}\PY{l+m}{2}\PY{p}{)} \PY{o}{/} \PY{p}{(}\PY{p}{(}\PY{n}{n}\PY{l+m}{\PYZhy{}2}\PY{p}{)} \PY{o}{*} \PY{p}{(}\PY{n}{n}\PY{l+m}{\PYZhy{}3}\PY{p}{)}\PY{p}{)}
    
    \PY{n}{A} \PY{o}{*} \PY{n}{B} \PY{o}{*} \PY{n}{S} \PY{o}{\PYZhy{}} \PY{n}{C}
\PY{p}{\PYZcb{}}

\PY{n+nf}{apply}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{l+m}{\PYZhy{}1}\PY{p}{]}\PY{p}{,} \PY{l+m}{2}\PY{p}{,} \PY{n}{g2}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{description*}
\item[Nationwide] -0.457241207817378
\item[Rural] -0.451444093083178
\item[Urban] -0.573162098915409
\end{description*}


    
    注：实际上，psych 包提供了一个 \texttt{describe}
函数，可以一次性得到各种常用值：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{13}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{describe}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{l+m}{\PYZhy{}1}\PY{p}{]}\PY{p}{,} \PY{n}{type}\PY{o}{=}\PY{l+m}{2}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    A psych: 3 × 13
\begin{tabular}{r|lllllllllllll}
  & vars & n & mean & sd & median & trimmed & mad & min & max & range & skew & kurtosis & se\\
  & <int> & <dbl> & <dbl> & <dbl> & <dbl> & <dbl> & <dbl> & <dbl> & <dbl> & <dbl> & <dbl> & <dbl> & <dbl>\\
\hline
	Nationwide & 1 & 22 & 1117.0000 & 1015.7166 &  727.5 & 1001.7222 &  673.8417 & 184 & 3180 & 2996 & 1.0248472 & -0.4572412 & 216.5515\\
	Rural & 2 & 22 &  747.8636 &  632.1976 &  530.5 &  682.7222 &  469.9842 & 138 & 1973 & 1835 & 1.0125612 & -0.4514441 & 134.7850\\
	Urban & 3 & 22 & 2336.4091 & 2129.8208 & 1499.5 & 2094.1111 & 1379.5593 & 405 & 6651 & 6246 & 0.9704641 & -0.5731621 & 454.0793\\
\end{tabular}


    
    \hypertarget{section}{%
\subsubsection{(2)}\label{section}}

\textbf{中位数}：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{14}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{apply}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{l+m}{\PYZhy{}1}\PY{p}{]}\PY{p}{,} \PY{l+m}{2}\PY{p}{,} \PY{n}{median}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{description*}
\item[Nationwide] 727.5
\item[Rural] 530.5
\item[Urban] 1499.5
\end{description*}


    
    \textbf{四分位距}：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{15}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{apply}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{l+m}{\PYZhy{}1}\PY{p}{]}\PY{p}{,} \PY{l+m}{2}\PY{p}{,} \PY{n}{quantile}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    A matrix: 5 × 3 of type dbl
\begin{tabular}{r|lll}
  & Nationwide & Rural & Urban\\
\hline
	0\% &  184.00 &  138.00 &  405.00\\
	25\% &  321.75 &  255.25 &  617.75\\
	50\% &  727.50 &  530.50 & 1499.50\\
	75\% & 1642.25 & 1052.25 & 3675.00\\
	100\% & 3180.00 & 1973.00 & 6651.00\\
\end{tabular}


    
    五数：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{16}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{fn} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{apply}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{l+m}{\PYZhy{}1}\PY{p}{]}\PY{p}{,} \PY{l+m}{2}\PY{p}{,} \PY{n}{fivenum}\PY{p}{)}
\PY{n}{fn}
\end{Verbatim}
\end{tcolorbox}

    A matrix: 5 × 3 of type dbl
\begin{tabular}{lll}
 Nationwide & Rural & Urban\\
\hline
	  184.0 &  138.0 &  405.0\\
	  311.0 &  246.0 &  603.0\\
	  727.5 &  530.5 & 1499.5\\
	 1746.0 & 1118.0 & 3891.0\\
	 3180.0 & 1973.0 & 6651.0\\
\end{tabular}


    
    四分位极差：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{17}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{R1} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{function}\PY{p}{(}\PY{n}{Q3}\PY{p}{,} \PY{n}{Q1}\PY{p}{)} \PY{n}{Q3} \PY{o}{\PYZhy{}} \PY{n}{Q1}

\PY{n+nf}{R1}\PY{p}{(}\PY{n}{Q3}\PY{o}{=}\PY{n}{fn}\PY{p}{[}\PY{l+m}{4}\PY{p}{,}\PY{p}{]}\PY{p}{,} \PY{n}{Q1}\PY{o}{=}\PY{n}{fn}\PY{p}{[}\PY{l+m}{2}\PY{p}{,}\PY{p}{]}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{description*}
\item[Nationwide] 1435
\item[Rural] 872
\item[Urban] 3288
\end{description*}


    
    三均值：

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{18}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{M3} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{function}\PY{p}{(}\PY{n}{Q1}\PY{p}{,} \PY{n}{M}\PY{p}{,} \PY{n}{Q3}\PY{p}{)} \PY{n}{Q1}\PY{o}{/}\PY{l+m}{4} \PY{o}{+} \PY{n}{M}\PY{o}{/}\PY{l+m}{2} \PY{o}{+} \PY{n}{Q3}\PY{o}{/}\PY{l+m}{4}

\PY{n+nf}{M3}\PY{p}{(}\PY{n}{Q1}\PY{o}{=}\PY{n}{fn}\PY{p}{[}\PY{l+m}{2}\PY{p}{,}\PY{p}{]}\PY{p}{,} \PY{n}{M}\PY{o}{=}\PY{n}{fn}\PY{p}{[}\PY{l+m}{3}\PY{p}{,}\PY{p}{]}\PY{p}{,} \PY{n}{Q3}\PY{o}{=}\PY{n}{fn}\PY{p}{[}\PY{l+m}{4}\PY{p}{,}\PY{p}{]}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{description*}
\item[Nationwide] 878
\item[Rural] 606.25
\item[Urban] 1873.25
\end{description*}


    
    \hypertarget{ux76f4ux65b9ux56fe}{%
\subsubsection{(3) 直方图}\label{ux76f4ux65b9ux56fe}}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{19}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{histogram} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{function}\PY{p}{(}\PY{n}{x}\PY{p}{,} \PY{n}{xname}\PY{o}{=}\PY{l+s}{\PYZdq{}}\PY{l+s}{x\PYZdq{}}\PY{p}{)} \PY{p}{\PYZob{}}
    \PY{n+nf}{hist}\PY{p}{(}\PY{n}{x}\PY{p}{,} \PY{n}{prob}\PY{o}{=}\PY{k+kc}{TRUE}\PY{p}{,} \PY{n}{main}\PY{o}{=}\PY{n+nf}{paste}\PY{p}{(}\PY{l+s}{\PYZdq{}}\PY{l+s}{Histogram of\PYZdq{}} \PY{p}{,} \PY{n}{xname}\PY{p}{)}\PY{p}{)}
    \PY{n+nf}{lines}\PY{p}{(}\PY{n+nf}{density}\PY{p}{(}\PY{n}{x}\PY{p}{)}\PY{p}{)}
    \PY{n+nf}{rug}\PY{p}{(}\PY{n}{x}\PY{p}{)} \PY{c+c1}{\PYZsh{} show the actual data points}
\PY{p}{\PYZcb{}}
\end{Verbatim}
\end{tcolorbox}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{20}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{c+c1}{\PYZsh{} layout(matrix(c(1,2,3), nr=1, byrow=T))}
\PY{n+nf}{histogram}\PY{p}{(}\PY{n}{Nationwide}\PY{p}{,} \PY{n}{xname}\PY{o}{=}\PY{l+s}{\PYZdq{}}\PY{l+s}{Nationwide\PYZdq{}}\PY{p}{)}
\PY{n+nf}{histogram}\PY{p}{(}\PY{n}{Rural}\PY{p}{,} \PY{n}{xname}\PY{o}{=}\PY{l+s}{\PYZdq{}}\PY{l+s}{Rural\PYZdq{}}\PY{p}{)}
\PY{n+nf}{histogram}\PY{p}{(}\PY{n}{Urban}\PY{p}{,} \PY{n}{xname}\PY{o}{=}\PY{l+s}{\PYZdq{}}\PY{l+s}{Urban\PYZdq{}}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_38_0.png}
    \end{center}
    { \hspace*{\fill} \\}
    
    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_38_1.png}
    \end{center}
    { \hspace*{\fill} \\}
    
    \begin{center}
    \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{output_38_2.png}
    \end{center}
    { \hspace*{\fill} \\}
    
    \hypertarget{ux830eux53f6ux56fe}{%
\subsubsection{(4) 茎叶图}\label{ux830eux53f6ux56fe}}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{21}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{stem}\PY{p}{(}\PY{n}{Nationwide}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{Verbatim}[commandchars=\\\{\}]

  The decimal point is 3 digit(s) to the right of the |

  0 | 22233344567889
  1 | 137
  2 | 368
  3 | 02

    \end{Verbatim}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{22}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{stem}\PY{p}{(}\PY{n}{Rural}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{Verbatim}[commandchars=\\\{\}]

  The decimal point is 3 digit(s) to the right of the |

  0 | 1222223344
  0 | 566679
  1 | 14
  1 | 899
  2 | 0

    \end{Verbatim}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{23}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{stem}\PY{p}{(}\PY{n}{Urban}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    \begin{Verbatim}[commandchars=\\\{\}]

  The decimal point is 3 digit(s) to the right of the |

  0 | 44566678914679
  2 | 409
  4 | 948
  6 | 27

    \end{Verbatim}

    \hypertarget{ux5f02ux5e38ux503c}{%
\subsubsection{(5) 异常值}\label{ux5f02ux5e38ux503c}}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{24}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n}{abnormal} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{function}\PY{p}{(}\PY{n}{x}\PY{p}{)} \PY{p}{\PYZob{}}
    \PY{n}{fn} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n+nf}{fivenum}\PY{p}{(}\PY{n}{x}\PY{p}{)}\PY{p}{;}
    \PY{n}{Q1} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n}{fn}\PY{p}{[}\PY{l+m}{2}\PY{p}{]}\PY{p}{;}  \PY{n}{Q3} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n}{fn}\PY{p}{[}\PY{l+m}{4}\PY{p}{]}\PY{p}{;}
    
    \PY{n}{R1} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n}{Q3} \PY{o}{\PYZhy{}} \PY{n}{Q1}
    
    \PY{n}{QD} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n}{Q1} \PY{o}{\PYZhy{}} \PY{l+m}{1.5} \PY{o}{*} \PY{n}{R1}
    \PY{n}{QU} \PY{o}{\PYZlt{}\PYZhy{}} \PY{n}{Q3} \PY{o}{+} \PY{l+m}{1.5} \PY{o}{*} \PY{n}{R1}
    
    \PY{n}{x}\PY{p}{[}\PY{p}{(}\PY{n}{x} \PY{o}{\PYZlt{}} \PY{n}{QD}\PY{p}{)} \PY{o}{|} \PY{p}{(}\PY{n}{x} \PY{o}{\PYZgt{}} \PY{n}{QU}\PY{p}{)}\PY{p}{]}
\PY{p}{\PYZcb{}}
\end{Verbatim}
\end{tcolorbox}

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{25}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{apply}\PY{p}{(}\PY{n}{data}\PY{p}{[}\PY{l+m}{\PYZhy{}1}\PY{p}{]}\PY{p}{,} \PY{l+m}{2}\PY{p}{,} \PY{n}{abnormal}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}

    

    
    结果为空：没有异常值。

    \begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm,colback=cellbackground, colframe=cellborder]
\prompt{In}{incolor}{26}{\boxspacing}
\begin{Verbatim}[commandchars=\\\{\}]
\PY{n+nf}{detach}\PY{p}{(}\PY{n}{data}\PY{p}{)}
\end{Verbatim}
\end{tcolorbox}


    % Add a bibliography block to the postdoc
    
    
    
\end{document}
